package com.mlblog_springboot.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/OP/**")// 拦截所有以 /OP/ 开头的请求
                .excludePathPatterns("/OP")// 排除 /OP 路径
                .excludePathPatterns("/OP/login");// 排除 /OP/login 路径
    }
}
